//
//  HYRoleView.m
//  HaiYue
//
//  Created by skyline on 2018/1/25.
//  Copyright © 2018年 skyline. All rights reserved.
//

#import "HYRoleView.h"
@interface HYRoleView()
@property (nonatomic, strong) HYImageView *IMG;
@property (nonatomic, strong) HYLabel *gameLBL;
@property (nonatomic, strong) HYLabel *areaLBL;
@property (nonatomic, strong) HYLabel *tipsLBL;
@end
@implementation HYRoleView
- (instancetype)init
{
    self = [super init];
    if (self)
    {
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}
- (instancetype)initWithHeight:(CGFloat)height
{
    self = [super init];
    if (self)
    {
        self.bounds = CGRectMake(0, 0, 0, height);
        self.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (HYImageView *)IMG
{
    if (!_IMG)
    {
        _IMG = [[HYImageView alloc] initWithCornerRadius: GAP];
        [self addSubview:_IMG];
        [_IMG mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self);
            make.left.equalTo(self).with.offset(GAP);
            make.size.mas_equalTo(CGSizeMake(self.bounds.size.height, self.bounds.size.height));
        }];
    }
    return _IMG;
}

- (HYLabel *)gameLBL
{
    if (!_gameLBL)
    {
        _gameLBL = [[HYLabel alloc] initWithText:@"" textColor:TEXT_BLACK_COLOR textFont:[UIFont systemFontOfSize:TitleFont]];
        [self addSubview:_gameLBL];
        [_gameLBL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.IMG);
            make.left.equalTo(self.IMG.mas_right).with.offset(GAP / 2.0);
        }];
    }
    return _gameLBL;
}

- (HYLabel *)areaLBL
{
    if (!_areaLBL)
    {
        _areaLBL = [[HYLabel alloc] initWithText:@"" textColor:ORANGE_COLOR textFont:[UIFont systemFontOfSize:TipsFont]];
        [self addSubview:_areaLBL];
        [_areaLBL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.IMG.mas_right).with.offset(GAP / 2.0);
            make.centerY.equalTo(self.IMG.mas_centerY).with.offset(GAP / 2.0);
        }];
    }
    return _areaLBL;
}

- (HYLabel *)tipsLBL
{
    if (!_tipsLBL)
    {
        _tipsLBL = [[HYLabel alloc] initWithText:@"" textColor:TEXT_GRAY_COLOR textFont:[UIFont systemFontOfSize:TipsFont]];
        [self addSubview:_tipsLBL];
        [_tipsLBL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.IMG.mas_right).with.offset(GAP / 2.0);
            make.bottom.equalTo(self.IMG);
        }];
    }
    return _tipsLBL;
}

- (void)setImageName:(NSString *)imageName
{
    if (_imageName != imageName)
    {
        _imageName = imageName;
        self.IMG.image = [UIImage imageNamed:_imageName];
    }
}

- (void)setGame:(NSString *)game
{
    if (_game != game)
    {
        _game = game;
        self.gameLBL.text = _game;
    }
}

- (void)setArea:(NSString *)area
{
    if (_area != area)
    {
        _area = area;
        self.areaLBL.text = _area;
    }
}

- (void)setTips:(NSString *)tips
{
    if (_tips != tips)
    {
        _tips = tips;
        self.tipsLBL.text = _tips;
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
